[![Creative Commons Zero 1.0](https://i.creativecommons.org/p/zero/1.0/88x31.png "Creative Commons Zero 1.0")](https://creativecommons.org/share-your-work/public-domain/cc0/)


-----


# RoleMemberFetch
Catchy name, right?

## What Is it?
This is a single-purpose Discord microbot that can fetch a list of users that have a specific role and store their IDs in a JSON file. The data in the outputted file is not readable by a human, however it can be converted into a human-readable format through the use of other scripts/bots.

Please note that this bot is *not* actively maintained, and there is no guarantee that it will be compatible with future versions of Discord.

## How Do I Use It?
This guide assumes that you are familiar with the Node.js Runtime Environment and the Discord Developer portal. Please note that **Node.js 10.4** or higher is required in order to run this bot.

* Go to the [Discord Developer portal](https://discord.com/developers/applications) and create a new application.
* Create a bot account for the application (done via the Bot page in the application's settings) and grant it the **Server Members** and **Message Content** privileged intents.
* Download the files in this repository (only the files in the `src` folder are required.)
* Open up the `config.json` file using a text editor, and paste in the token of your newly created bot where it says `INSERT TOKEN HERE`.
* Paste your Discord user ID where it says `INSERT YOUR USER ID HERE`. (If you do not know how to obtain your user ID, please follow [this guide](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-).)
* Open up a terminal/command prompt, and navigate to the directory where the bot is located.
* Run the following command: `npm i`
* Then, run this command: `node rolefetch`
* When the bot is online, run the `>)fetch <ROLE ID>` command - replacing `<ROLE ID>` with the ID of the role whose members you wish to fetch. (Role names will not work!)
* You may view the fetched IDs in the `output.json` file, located within the `output` subdirectory within the bot's directory.
* Repeat the process for any additional roles. The bot will append these roles onto the JSON file.

## Is It Safe to Delete the Output File?
Yes. Just delete the `output.json` file as you would with any other file. This will not break anything and the bot will automatically re-create the file when the fetch command is run next time.

## Can I Use This As Part of My Own Bot Project?
Yes. This work is licensed under the [Creative Commons Zero 1.0](https://creativecommons.org/share-your-work/public-domain/cc0/) license (Public Domain.) Credit is appreciated, but not required.